|
|
|
|
|
|
|
Figure 5.16.
The Object Browser will display all found references of a search string. |
|
|
|
|
|
|
|
|
One of the most useful control statements that you can use in Visual Basic is the loop. Loops are used to perform most of the repetitive tasks in any application. You can use two types of loops when creating a Visual Basic application, the counter and conditional loops. Conditional loops perform a task until a specified condition occurs, and counter loops will execute for a set number of times. If you search the Visual Basic Help system for the word loops, several topics are listed. All of these topics fall into one of the two mentioned loop types. |
|
|
|
|
|
|
|
|
In programming languages, a counter loop is usually known as a For loop or a ForNext loop. In reference to this chapter, there is actually a third version of this loop called a For EachNext loop that is used specifically for collections and arrays. Each loop is defined at the beginning with a For statement and ends with a Next statement. The syntax of a standard ForNext loop is as follows: |
|
|
|
|
|
|
|
|
For counter = start To end [Step step]
[statements]
[Exit For]
[statements]
Next [counter] |
|
|
|
|
|